package cn.blbsz.shop.utils;

import cn.blbsz.shop.domain.p.UserEntity;
import cn.blbsz.shop.security.UserDetail;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * Created by yipingdong on 2017/4/12.
 */
public class SecurityUtil {

    public static UserEntity getCurrentUser() {
        return ((UserDetail) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUserEntity();
    }
}
